package com.ruoyi.supermarket.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.supermarket.domain.Xqyfpay;
import com.ruoyi.supermarket.service.IXqyfpayService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 应付详情Controller
 * 
 * @author ruoyi
 * @date 2024-05-30
 */
@RestController
@RequestMapping("/supermarket/xqyfpay")
public class XqyfpayController extends BaseController
{
    @Autowired
    private IXqyfpayService xqyfpayService;

    /**
     * 查询应付详情列表
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:list')")
    @GetMapping("/list")
    public AjaxResult list(Xqyfpay xqyfpay)
    {
//        startPage();
        List<Xqyfpay> list = xqyfpayService.selectXqyfpayList(xqyfpay);
        return success(list);
    }

    /**
     * 导出应付详情列表
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:export')")
    @Log(title = "应付详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Xqyfpay xqyfpay)
    {
        List<Xqyfpay> list = xqyfpayService.selectXqyfpayList(xqyfpay);
        ExcelUtil<Xqyfpay> util = new ExcelUtil<Xqyfpay>(Xqyfpay.class);
        util.exportExcel(response, list, "应付详情数据");
    }

    /**
     * 获取应付详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:query')")
    @GetMapping(value = "/{xqyfpayId}")
    public AjaxResult getInfo(@PathVariable("xqyfpayId") Long xqyfpayId)
    {
        return success(xqyfpayService.selectXqyfpayByXqyfpayId(xqyfpayId));
    }

    /**
     * 新增应付详情
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:add')")
    @Log(title = "应付详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Xqyfpay xqyfpay)
    {
        return toAjax(xqyfpayService.insertXqyfpay(xqyfpay));
    }

    /**
     * 修改应付详情
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:edit')")
    @Log(title = "应付详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Xqyfpay xqyfpay)
    {
        return toAjax(xqyfpayService.updateXqyfpay(xqyfpay));
    }

    /**
     * 删除应付详情
     */
    @PreAuthorize("@ss.hasPermi('supermarket:xqyfpay:remove')")
    @Log(title = "应付详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xqyfpayIds}")
    public AjaxResult remove(@PathVariable Long[] xqyfpayIds)
    {
        return toAjax(xqyfpayService.deleteXqyfpayByXqyfpayIds(xqyfpayIds));
    }
}
